//第2关 矩阵转置
package step2;
import java.util.Scanner;

public class SwapMatrix {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[][] matrix = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				matrix[i][j] = scanner.nextInt();
			}
		}
        /********** Begin **********/
		System.out.println("原始数组为：");
        for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				System.out.print(matrix[i][j]+" ");
			}
            System.out.println();
		}


		int[][] matrix1 = new int[3][3];
        for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				matrix1[i][j] = matrix[j][i];
			}
		}
        
		System.out.println("行列互调后数组为：");
		
        for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				System.out.print(matrix1[i][j]+" ");
			}
            System.out.println();
		}
        
        
        
        
        
        
        
        /********** End **********/
		scanner.close();
	}

}